<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>损失信息录入</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../plugins/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="../css/font_eolqem241z66flxr.css" media="all" />

</head>
<body class="childrenBody">
<blockquote class="layui-elem-quote" style="border-left: 5px solid #ffffff">
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>损失信息录入</legend>
    </fieldset>
</blockquote>
<form class="layui-form">

    <div class="layui-form-item">
        <label class="layui-form-label">事故编号</label>
        <div class="layui-input-inline">
            <input type="text" class="layui-input accidentId" lay-verify="required" placeholder="请输入事故编号">
        </div>

        <label class="layui-form-label">事故名称</label>
        <div class="layui-input-inline">
            <input type="text" class="layui-input accidentName" lay-verify="required" placeholder="请输入事故名称">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">损失等级</label>
        <div class="layui-input-inline">
            <select name="lossLevel" class="lossLevel" lay-verify="required">
                <option value="">请选择</option>
                <option value="1">一般损失事故</option>
                <option value="2">较大损失事故</option>
                <option value="3">重大损失事故</option>
                <option value="4">特大损失事故</option>
            </select>
        </div>

        <label class="layui-form-label">人员伤亡</label>
        <div class="layui-input-inline">
            <input type="number" class="layui-input number" placeholder="例如：33">
        </div>

    </div>

    <div class="layui-form-item">

        <label class="layui-form-label">经济损失</label>
        <div class="layui-input-inline">
            <input type="text" class="layui-input money" placeholder="例如：33万元">
        </div>

        <label class="layui-form-label">环境损害</label>
        <div class="layui-input-inline">
            <input type="text" class="layui-input environment" placeholder="例如：湖泊富营养化">
        </div>

    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">船舶、设施受损部位简图</label>
        <button type="button" class="layui-btn" id="picture">
            <i class="layui-icon">&#xe62f;</i>上传图片
        </button>
    </div>



    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="addLoss">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script type="text/javascript" src="../layui/layui.js"></script>
<script type="text/javascript" src="../js/loss_add.js"></script>
<script>
    layui.use(['form','upload'], function () {
        var form=layui.form;

        var $ = layui.jquery
                ,upload = layui.upload;
        <!--图片上传-->


            //执行实例
            var uploadInst = upload.render({
                elem: '#picture' //绑定元素
                ,url: '/upload/' //上传接口
                ,before: function(obj){
                    //预读本地文件示例，不支持ie8
                    obj.preview(function(index, file, result){
                        $('#demo1').attr('src', result); //图片链接（base64）
                    });
                }
                ,done: function(res){
                    //如果上传失败
                    if(res.code > 0){
                        return layer.msg('上传失败');
                    }
                    //上传成功
                    //上传完毕回调
                }
                ,error: function(){
//                演示失败状态，并实现重传
                    var demoText = $('#demoText');
                    demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
                    demoText.find('.demo-reload').on('click', function(){
                        uploadInst.upload();
                    });
                    //请求异常回调
                }
            });


    });
</script>
</body>
</html>